package com.atguigu.gulimall.product.entity;

import com.atguigu.common.group.AddGroup;
import com.atguigu.common.group.UpdateGroup;
import com.atguigu.common.validate.ListValue;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author shujun
 * @email 961624576@qq.com
 * @date 2024-01-12 18:44:30
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
    @Null(groups = {AddGroup.class},message = "新增时不能brandId必须为空")
    @NotNull(groups = {UpdateGroup.class},message = "新增时不能brandId必须非空")
	private Long brandId;
	/**
	 * 品牌名
	 */
    //todo 这里修改的时候应该可以为null，为null则不修改此值；但不能为空串或只含空格等空白符
    @NotBlank(groups = {AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
    @NotBlank(groups = {AddGroup.class})
    @URL(groups = {UpdateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class})
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
//    @NotNull
//    @Min(0)
//    @Max(1)
    @ListValue(vals = {0,1},groups = {AddGroup.class, UpdateGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
    @Pattern(regexp = "^[a-zA-Z]$",groups = {AddGroup.class, UpdateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
    @NotNull
    @Min(value = 0,groups = {AddGroup.class, UpdateGroup.class})
	private Integer sort;

}
